//
//  LView.m
//  ProjectA_LK
//
//  Created by 萌萌的小坤坤 on 16/6/14.
//  Copyright © 2016年 冷坤. All rights reserved.
//

#import "LView.h"

@implementation LView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatLView];
    }
    return self;
}

- (void)creatLView{
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, 25)];
//    self.titleLabel.backgroundColor = [UIColor yellowColor];
    
    
    self.titleLabel.font = [UIFont systemFontOfSize:14];
    self.titleLabel.textColor = [UIColor whiteColor];
    [self addSubview:self.titleLabel];
    [_titleLabel release];
    
    self.fromLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.titleLabel.frame.origin.x, self.titleLabel.frame.origin.y + self.titleLabel.frame.size.height + 5, self.titleLabel.frame.size.width, self.titleLabel.frame.size.height)];
    
    self.fromLabel.font = [UIFont systemFontOfSize:12];
    self.fromLabel.textColor = [UIColor whiteColor];
//    self.fromLabel.backgroundColor = [UIColor greenColor];
    [self addSubview:self.fromLabel];
    [_fromLabel release];
    
    self.lineView = [[UIView alloc]initWithFrame:CGRectMake(self.fromLabel.frame.origin.x, self.fromLabel.frame.origin.y + self.fromLabel.frame.size.height + 5, self.fromLabel.frame.size.width, 1)];
    [self addSubview:self.lineView];
    
    self.lineView.backgroundColor = [UIColor whiteColor];
    [_lineView release];
    
    self.sentimentLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.fromLabel.frame.origin.x, self.lineView.frame.origin.y + 6, self.fromLabel.frame.size.width, self.fromLabel.frame.size.height)];
    self.sentimentLabel.font = [UIFont systemFontOfSize:12];
    self.sentimentLabel.textColor = [UIColor whiteColor];
//    self.sentimentLabel.backgroundColor = [UIColor blueColor];
    [self addSubview:self.sentimentLabel];
    [_sentimentLabel release];
    
}

-(void)setModel:(TXTModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    self.titleLabel.text = model.subject;
    self.fromLabel.text = [NSString stringWithFormat:@"by %@", model.user_name];
    self.sentimentLabel.text = @" 人气  /  收藏";
    
//    model.user_name;
    
    
//    [self.titleImage sd_setImageWithURL:[NSURL URLWithString:model.host_pic]];
//    self.lview.model = model;
    
    
    
}

@end
